home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / utilities / emulators / apple2emul.lzh / Notes < prev    next >
Text File  |  1991-04-18  |  4KB  |  71 lines

  1. The default escape character is ~
  2.  
  3. Speed is everything in the emulator.  I use macros instead of functions;
  4. autoincrement wherever I can; suitably sized variables to take advantage
  5. of wraparound so I don't have to & 0xFF or & 0xFFFF.  These things are done
  6. for speed, not safety, although they should work on most machines.  Hopefully
  7. the safety_check() routine will assert fail if at least some of these
  8. assumptions are not true.
  9.  
  10. The main loop of the cpu is handled by a big switch statement.  There
  11. are no function calls since they incur a large overhead.  I count on
  12. your compiler generating an efficient jump table for the switch.
  13.  
  14. The Apple's memory is represented by a 64K array of bytes (unsigned char).
  15. All memory references, with the exception of special locataions in the
  16. C000-CFFF range, come unintercepted from the mem array.
  17.  
  18. References in the C000-CFFF range are taken from the mem_map() function.
  19. It implements things such as the keyboard read & strobe locations and
  20. the bank switching toggles.  If mem_map() doesn't have a special hook
  21. for a Cxxx location, it will return the mem[] value associated with
  22. the location.  Thus you can load device PROM images there and you will
  23. be able to reference them.
  24.  
  25. Memory stores may be caught on a per-page basis.  For example, stores to
  26. the C0xx range are caught by store_c0().  Besides the Cxxx functions,
  27. store catching routines are used for the memory mapped video from $400-7FF
  28. also for the language card.
  29.  
  30. Certain PC values are intercepted and dealt with by C routines.  The 64K
  31. array jmp_tbl[] determines whether a location is "caught"; if zero, nothing
  32. will happen.  If non-zero, the value is passed to jump().  Pc's are only
  33. intercepted on JMP and JSR instructions (so that we don't pay a speed
  34. penalty for every instruction fetch).  This imposes obvious limitations
  35. on what code can be caught.
  36.  
  37. Intercepted routines include the ROM routines to handle scrolling, the
  38. ROM wait and bell calls, and some Cxxx calls.  Scrolling must be caught
  39. and done separately or it looks horrible.  RWTS and Prodos are also
  40. caught at the block read/write level to speed up disk access.
  41.  
  42. Note that none of the jump intercepts are necessary.  They speed up
  43. scrolling and disk access (for Prodos & DOS 3.3) quite a bit, but you
  44. can turn them all off and the emulator will still run.  The memory map
  45. support is enough.
  46.  
  47. The Pc catches ignore whether the language card is active or not; instead,
  48. they look for key values to see if they routines they're supposed to sit
  49. on top of really are there.  If not, they let the real code execute.
  50. If we just caught ROM calls, and didn't catch calls that executed when
  51. the RAM card was active, then copying the ROM into the language card and
  52. switching to it would cause us to lose all of our interception.
  53.  
  54. Beware when adding intercepts for the ROM or other functions: there's
  55. always some piece of code that depends on a side effect of a function.
  56.  
  57. The blocks in the disk image are ordered in DOS 3.3 layout.  The prodos
  58. code uses a mapping table.  Thus, one Prodos block consists of two non-
  59. contiguous 256 byte blocks in a disk image.
  60.  
  61. I only have the old Disk II boot prom from $C600.  Jump.c patches it to
  62. look something like a Prodos device controller, so that Prodos has high-
  63. level disk intercept support.  I don't know if a prom image from a newer
  64. disk controller will work or not.
  65.  
  66. The emulator supports raw access to the disk controller by nibble
  67. encoding sector images as they're fed in through the shift data register.
  68. A routine decodes the motion of the disk head based on references to
  69. the stepper magnets.
  70.  
  71.